package org.cashbook.core.objects.luxuryClass;

import java.io.Serializable;

import org.cashbook.core.IDFactory;
import org.cashbook.utilities.UtilitiesFactory;


public abstract class AbstractLuxuryClass implements ILuxuryClass, Serializable {
	private static final long serialVersionUID = -3535674823316063779L;
	protected int luxuryClassID;
	
	public AbstractLuxuryClass() {
		luxuryClassID = IDFactory.getLuxuryClassID();
		UtilitiesFactory.getLogger().fine("LuxuryClass instance created [Type " + getClassType() + "; ID " + luxuryClassID + "]", this);
	}

	@Override
	public int getID() {
		UtilitiesFactory.getLogger().finest("Returning luxury ID [Luxury ID " + luxuryClassID + "]", this);
		return luxuryClassID;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + luxuryClassID;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		AbstractLuxuryClass other = (AbstractLuxuryClass) obj;
		if (luxuryClassID != other.luxuryClassID)
			return false;
		return true;
	}
	
	public abstract String toString();

}
